#include <LibDL/options/dtype.h>

Dtype Dtype::get_dty(const std::string & dty) {
	if (dty[0] == 'I') {
		switch (dty[1]) {
		case '8':return torch::kInt8;
		case '1':return torch::kInt16;
		case '3':return torch::kInt32;
		case '6':return torch::kInt64;
		default:
			return torch::kInt;
		}
	} else if (dty[0] == 'F') {
		switch (dty[1]) {
		case '1':return torch::kFloat16;
		case '3':return torch::kFloat32;
		case '6':return torch::kFloat64;
		default:
			return torch::kFloat;
		}
	} else return torch::kInt; // to fix warning: Control may reach end of non-void function
}